#include "stm32f10x.h"                  // Device header
#include "Delay.h"

#include "LED.h"
#include "Key.h"
#include "OLED.h"
#include "AD.h"

uint16_t ADValue = 0;
float voltage = 0;


int main(void)
{
	// 初始化
	OLED_Init();
	AD_Init();
	
	OLED_ShowString(1, 1, "ADValue:");
	OLED_ShowString(2, 1, "Voltage:0.00V");
	
	while(1)
	{
		ADValue = AD_GetValue();
		voltage = (float)ADValue / 4095 * 3.3;
		OLED_ShowNum(1, 9, ADValue, 4);
		OLED_ShowNum(2, 9, voltage, 1);
		OLED_ShowNum(2, 11, ((uint16_t)(voltage * 100)) % 100, 2);
		
		Delay_ms(100);
	}
}